﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ShoppingCartDetail.ascx.cs" Inherits="webapp4U.UI.Usercontrol_ShoppingCartDetail" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register Assembly="webapp4U" TagPrefix="webapp4U" Namespace="webapp4U.UI" %>
<%@ Register Src="~/Usercontrol/Title.ascx" TagName="Title" TagPrefix="uc" %>
<%--<%@ Register src="~/Usercontrol/ShoppingCart.ascx" tagname="ShoppingCart" tagprefix="uc5" %>
--%>
<%@ Register src="uscMsgBox.ascx" tagname="uscMsgBox" tagprefix="uc1" %>

<asp:UpdatePanel ID="UpdatePanelOnShoppingCartDetails" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
    <uc1:uscMsgBox ID="uscMsgBox1" runat="server" Title="Thông báo" OKText="Đồng ý" CancelText="Bỏ qua" CloseText="Đóng lại"/>
    <table border="0" width="100px" cellpadding="0"  cellspacing="0" align="center">
    <tr>
        <td style="padding-top:5pt;" align="center">
            <asp:GridView runat="server" Width="500px" HorizontalAlign="Center" 
                ID="GridViewItem" 
                AutoGenerateColumns="False" 
                AllowPaging="True" 
                AllowSorting="False" 
                PagerSettings-Mode="NumericFirstLast"
                GridLines="None" 
                EnableModelValidation="True" PageSize="20" 
                onrowdeleting="GridViewItem_RowDeleting">
                <Columns>
                    <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px" HeaderStyle-Width="20px"
                        HeaderText="Delete">
                        <HeaderTemplate>
                            <input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server" type="checkbox" />
                            <%--<asp:CheckBox runat="server" ID="chkSelectMulti"  />--%>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox runat="server" ID="chkSelect" ToolTip='<%# Eval("ItemKey") %>' />
                        </ItemTemplate>
                        <HeaderStyle Width="20px" />
                        <ItemStyle HorizontalAlign="Center" Width="20px" />
                    </asp:TemplateField>
                                                        
                    <asp:TemplateField HeaderText="Image" 
                        HeaderStyle-Width="60" ItemStyle-Width="60"
                        HeaderStyle-HorizontalAlign="Center"
                        ItemStyle-HorizontalAlign="Center">
                        <HeaderTemplate><%=ResourceManager.GetString("Image") %></HeaderTemplate>
                        <ItemTemplate>
                            <table>
                                <tr>
                                    <td align="center" width="41px" height="41px" style="border:solid 1px #cccccc; cursor:pointer">
                                         <img border="0" src='<%=Globals.ApplicationPath %>Page/Products/Image.ashx?Size=S&ImageUrl=<%# webapp4U.BOL.Products.GetImageUrlByID((string)Eval("ItemKey"))%>' />   
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="60px" />
                        <ItemStyle HorizontalAlign="Center" Width="60px" />
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Sản phẩm" 
                        HeaderStyle-Width="200" ItemStyle-Width="200" ItemStyle-Height="40"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <HeaderTemplate><%=ResourceManager.GetString("Product_TenSanPham")%></HeaderTemplate>
                        <ItemTemplate>
                            <%# Eval("Description") %>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Left" Width="200px" />
                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Giá bán(VNĐ)" 
                        HeaderStyle-Width="100" ItemStyle-Width="100"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <HeaderTemplate><%=ResourceManager.GetString("Product_Price")%></HeaderTemplate>
                        <ItemTemplate>
                              <span style="font-weight:normal"><%# (float)Eval("UnitPrice")%> VNĐ</span>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        <ItemStyle HorizontalAlign="Left" Width="100px" />
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px" HeaderStyle-Width="100px"
                        HeaderText="Delete">
                        <HeaderTemplate><%=ResourceManager.GetString("Product_Quantity")%></HeaderTemplate>
                        <ItemTemplate>
                            <asp:TextBox runat="server" ID="txtQuantity" Text='<%# Eval("Quantity") %>' 
                                Width="40" ontextchanged="txtQuantity_TextChanged" AutoPostBack="True"></asp:TextBox>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                        <ItemStyle HorizontalAlign="Center" Width="100px" />
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Thành Tiền(VNĐ)" 
                        HeaderStyle-Width="100" ItemStyle-Width="100"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <HeaderTemplate><%=ResourceManager.GetString("Product_UnitSubTotal")%></HeaderTemplate>
                        <ItemTemplate>
                              <span style="font-weight:normal"><%# (Double)Eval("Subtotal")%> VNĐ</span>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        <ItemStyle HorizontalAlign="Left" Width="100px" />
                    </asp:TemplateField>

                     <asp:TemplateField HeaderText="Xóa" 
                        HeaderStyle-Width="60" ItemStyle-Width="60"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <HeaderTemplate><%=ResourceManager.GetString("Delete")%></HeaderTemplate>
                        <ItemTemplate>                            
                             <asp:LinkButton ID="linkbntDelete" runat="server" 
                                CausesValidation="False" CommandName="Delete">
                                <img src="<%=Globals.ImagesUrl() %>Delete.png"
                                    title="Xóa sản phảm này khỏi giỏ hàng" 
                                    height="40" width="40" />                                
                            </asp:LinkButton>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Left" Width="60px" />
                        <ItemStyle HorizontalAlign="Left" Width="60px" />
                    </asp:TemplateField>

                </Columns>
                <EmptyDataTemplate>
                    <table align="center" width="100%" border="0" bgcolor="#ffffcc" bordercolorlight="#0099cc"  bordercolor="#0099cc">
                        <tr>
                            <td height="50" align="center">
                                <div align="center" id="EmptyData"><%=ResourceManager.GetString("Product_ShoppingCartEmpty")%></div>
                            </td>   
                        </tr>
                    </table>
                </EmptyDataTemplate>
                <PagerSettings Mode="NumericFirstLast" />
            </asp:GridView>    
            
        </td>
    </tr>

    <tr>
        <td style="padding-top:0pt;" align="center">
            <asp:GridView runat="server" Width="500px" HorizontalAlign="Center" 
                ID="GridViewItemStarkit" 
                AutoGenerateColumns="False" 
                AllowPaging="True" 
                AllowSorting="False" 
                PagerSettings-Mode="NumericFirstLast"
                GridLines="None" 
                EnableModelValidation="True" PageSize="20" ShowHeader="False">
                <Columns>
                    <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px" HeaderStyle-Width="20px"
                        HeaderText="Delete">
                        <HeaderTemplate>
                            <input id="chkAll" runat="server" type="checkbox" />
                            <%--<asp:CheckBox runat="server" ID="chkSelectMulti"  />--%>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox runat="server" ID="chkSelect" Enabled="false" ToolTip='<%# Eval("ItemKey") %>' />
                        </ItemTemplate>
                        <HeaderStyle Width="20px" />
                        <ItemStyle HorizontalAlign="Center" Width="20px" />
                    </asp:TemplateField>
                                                        
                    <asp:TemplateField HeaderText="Image" 
                        HeaderStyle-Width="60" ItemStyle-Width="60"
                        HeaderStyle-HorizontalAlign="Center"
                        ItemStyle-HorizontalAlign="Center">
                        <HeaderTemplate><%=ResourceManager.GetString("Image") %></HeaderTemplate>
                        <ItemTemplate>
                            <table>
                                <tr>
                                    <td align="center" width="41px" height="41px" style="border:solid 1px #cccccc; cursor:pointer">
                                         <img border="0" src='<%=Globals.ApplicationPath %>Page/Products/Image.ashx?Size=S&ImageUrl=<%# webapp4U.BOL.Products.GetImageUrlByID((string)Eval("ItemKey"))%>' />   
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="60px" />
                        <ItemStyle HorizontalAlign="Center" Width="60px" />
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Sản phẩm" 
                        HeaderStyle-Width="200" ItemStyle-Width="200" ItemStyle-Height="40"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <HeaderTemplate><%=ResourceManager.GetString("Product_TenSanPham")%></HeaderTemplate>
                        <ItemTemplate>
                            <%# Eval("Description") %>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Left" Width="200px" />
                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Giá bán(VNĐ)" 
                        HeaderStyle-Width="100" ItemStyle-Width="100"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <HeaderTemplate><%=ResourceManager.GetString("Product_Price")%></HeaderTemplate>
                        <ItemTemplate>
                              <span style="font-weight:normal"><%# (float)Eval("UnitPrice")%> VNĐ</span>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        <ItemStyle HorizontalAlign="Left" Width="100px" />
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px" HeaderStyle-Width="100px"
                        HeaderText="Delete">
                        <HeaderTemplate><%=ResourceManager.GetString("Product_Quantity")%></HeaderTemplate>
                        <ItemTemplate>
                            <span style="font-weight:normal"><%# Eval("Quantity") %></span>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                        <ItemStyle HorizontalAlign="Center" Width="100px" />
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Thành Tiền(VNĐ)" 
                        HeaderStyle-Width="100" ItemStyle-Width="100"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <HeaderTemplate><%=ResourceManager.GetString("Product_UnitSubTotal")%></HeaderTemplate>
                        <ItemTemplate>
                              <span style="font-weight:normal"><%# (Double)Eval("Subtotal")%> VNĐ</span>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        <ItemStyle HorizontalAlign="Left" Width="100px" />
                    </asp:TemplateField>

                     <asp:TemplateField HeaderText="Xóa" 
                        HeaderStyle-Width="60" ItemStyle-Width="60"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <HeaderTemplate><%=ResourceManager.GetString("Delete")%></HeaderTemplate>
                        <ItemTemplate>                            
                             <asp:LinkButton ID="linkbntDelete" runat="server" 
                                CausesValidation="False" Enabled="false">
                                <img src="<%=Globals.ImagesUrl() %>Delete.png"
                                    title="Xóa sản phảm này khỏi giỏ hàng" 
                                    height="40" width="40" />                                
                            </asp:LinkButton>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Left" Width="60px" />
                        <ItemStyle HorizontalAlign="Left" Width="60px" />
                    </asp:TemplateField>

                </Columns>
                <PagerSettings Mode="NumericFirstLast" />
            </asp:GridView>    
            
        </td>
    </tr>

    <tr>
        <td align="right"> 
            <asp:Panel runat="server" ID="PanelUpdate">
                <table cellpadding="0" cellspacing="0">
                    <tr>
                        <td align="right" class="ProductPrice" style="padding-top:8px;">
                            <%=ResourceManager.GetString("Product_Subtotal")%>: <%=GetTotalShoppingCart()%>  &nbsp; VNĐ
                        </td>
                    </tr>
                    <tr>
                        <td align="right" style="padding-top:8px;">
                        <webapp4U:Button CssClass="bt_submit" runat="server" ID="btn_ContinueShopping" Text=" Tiếp tục mua hàng " ResourceName="Product_ContinueShopping" OnClick="btn_ContinueShopping_Click"  />
                         &nbsp;   <webapp4U:Button runat="server" ID="btDelete" Text=" Delete " ResourceName="Product_Delete" OnClick="btDelete_Click" CssClass="bt_submit" />     
                          &nbsp;   <webapp4U:Button runat="server" ID="btnApKM" Text=" Áp khuyến mãi " ResourceName="btnApKM" Visible="false"
                            CssClass="bt_submit"    onclick="btnApKM_Click"/>                                         
                        </td>                           
                    </tr>
                    
                    
                </table>
            </asp:Panel>
        </td>
    </tr>
    </table>       
   </ContentTemplate>
</asp:UpdatePanel>